import request from '@/utils/request'

export function getBrandPages(params) {
  return request({
    url: '/base/brand/getPage',
    method: 'get',
    params
  })
}

export function getBrandTree(params) {
  return request({
    url: '/base/brand/getTree',
    method: 'get',
    params
  })
}

export function getTreeNotNull(params) {
  return request({
    url: '/base/brand/getTreeNotNull',
    method: 'get',
    params
  })
}

export function getTreeWithGoods(params) {
  return request({
    url: '/base/brand/getTreeWithGoods',
    method: 'get',
    params
  })
}

export function getUserBrandTree(params) {
  return request({
    url: '/base/brand/getUserFTree',
    method: 'get',
    params
  })
}

export function getBrandById(params) {
  return request({
    url: '/base/brand/getById',
    method: 'get',
    params
  })
}

export function brandAdd(data) {
  return request({
    url: '/base/brand/add',
    method: 'post',
    data
  })
}

export function brandUpdate(data) {
  return request({
    url: '/base/brand/edit',
    method: 'post',
    data
  })
}

export function brandUpdateDisabled(ids, enable) {
  let _ids = []
  if (Array.isArray(ids)) _ids = ids
  else _ids = [ids]
  return request({
    method: 'get',
    url: '/base/brand/updateStatus',
    params: {
      ids: _ids.join(','),
      status: enable
    }
  })
}

export function brandDel(params) {
  return request({
    url: '/base/brand/deleteById',
    method: 'get',
    params
  })
}

